package com.rednose.videoplayer.controller;
import android.content.Context;

import com.rednose.videoplayer.Dao.ListVideoDao;
import com.rednose.videoplayer.model.MediaFiles;
import com.rednose.videoplayer.model.*;

import java.util.ArrayList;

public class PlayListController {
    private ListVideoDao listVideoDao;

    public PlayListController(Context context) {
        listVideoDao = new ListVideoDao(context);
    }

    public ArrayList<ListVideo> getPlayList(User user) {
        return listVideoDao.getListVideoByUser(user);
    }

    public void addToPlayList() {
    }

    public void addToPlayListTail(ListVideo listVideo, User user) {
        //配置一下position然后添加
        int newPosition = listVideoDao.getVideoCount(user.getUserID() + 1);
        listVideo.setPosition(newPosition);
        listVideoDao.addListVideo(listVideo);
    }

    public void deleteFromPlayList(MediaFiles deleteFile, User user) {
        String MediaID = deleteFile.getId();
        int userID = user.getUserID();
listVideoDao.deleteListVideo(MediaID, userID);
    }
}
